﻿using System;

namespace Program06
{
    class Program
    {
        static void Main(string[] args)
        {
            int num;
            int max=0;
            int min=0;
            Console.WriteLine("请输入一个整数（输入0结束）");
            num = Convert.ToInt32(Console.ReadLine());
            min = max = num;
            while (num!=0)
            {
                
                if (num<min)//如果录入的值比储存的值小替换之
                {
                    min = num;
                }
                else if(num>max)//如果录入的值比储存的值大替换之
                {
                    max = num;
                }
                Console.WriteLine("请输入一个数输入0结束");
                num = Convert.ToInt32(Console.ReadLine());
                if (num == 0)
                {
                    Console.WriteLine("结束");
                }

            }
            Console.WriteLine("最大值：" + max + "最小值：" + min);
            Console.ReadLine();
        }
    }
}
